#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i <= (int)(b); ++i)

using namespace std;
const int N = 1004;
bitset<N> Mat[2 * N];
int gauss(int n, int m) {
  int k = -1;
  rep(i, 1, n) {
    int cur = i;
    while (cur <= m && !Mat[cur][i]) cur++;
    if (cur > m) return 0;
    k = max(k, cur);
    if (cur != i) swap(Mat[cur], Mat[i]);
    rep(j, 1, m) if (i != j && Mat[j].test(i)) Mat[j] ^= Mat[i];
  }
  return k;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  string s;
  for (int i = 1, b; i <= m; ++i) {
    cin >> s >> b;
    rep(j, 1, n) Mat[i].set(j, s[j - 1] == '1');
    Mat[i].set(0, b);
  }
  int k = gauss(n, m);
  if (k) {
    cout << k << endl;
    rep(i, 1, n) cout << (Mat[i][0] ? "?y7M#" : "Earth") << endl;

  } else {
    cout << "Cannot Determine\n";
  }
}
